Skip to content

fix: suggest --wallet-name when already connected#38

Merged
rolznz merged 1 commit into
masterfrom
fix/already-connected-suggest-wallet-name
May 28, 2026
Merged

fix: suggest --wallet-name when already connected#38
rolznz merged 1 commit into
masterfrom
fix/already-connected-suggest-wallet-name

Conversation

@rolznz
Copy link
Copy Markdown
Member

@rolznz rolznz commented May 25, 2026

Summary

  • The Already connected error from auth and connect now suggests connecting an additional wallet via --wallet-name <name>, in addition to the existing --force hint.
  • Enabled Commander's showGlobalOptions so global flags (--wallet-name, --connection-secret, --verbose) now appear under a Global Options section in every subcommand's --help — previously they were only visible in top-level help.

Closes #37

Test plan

  • yarn build passes
  • auth --help shows --wallet-name under "Global Options"
  • Triggering the "Already connected" error shows the new --wallet-name suggestion
  • Integration tests requiring a live NWC wallet (pre-existing, unrelated)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Connection error messages now provide enhanced guidance when secrets already exist, informing users they can use --force to overwrite or --wallet-name <name> to connect an additional wallet instead.
    • The CLI help output now displays global options, making them more discoverable and accessible to users.

Review Change Stack

The "Already connected" error from `auth` and `connect` now suggests
connecting an additional wallet via --wallet-name, alongside --force.
Also enables showGlobalOptions so global flags like --wallet-name appear
in every subcommand's --help.

Closes #37

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 49bacebf-ff59-41b0-b54f-e4ea4f78bf8a

📥 Commits

Reviewing files that changed from the base of the PR and between d14bdc9 and 488978c.

📒 Files selected for processing (3)
  • src/commands/auth.ts
  • src/commands/connect.ts
  • src/index.ts

📝 Walkthrough

Walkthrough

The pull request enhances CLI user guidance across three targeted areas: error messages for both authentication and connection commands now suggest using --wallet-name <name> to connect additional wallets, and the help output configuration is updated to display global options alongside command-specific options.

Changes

CLI User Guidance Enhancements

Layer / File(s) Summary
Wallet connection error message guidance
src/commands/auth.ts, src/commands/connect.ts
Error messages when a connection secret already exists are extended to instruct users to use --wallet-name <name> to connect an additional wallet, complementing the existing --force override instruction.
Global options visibility in help output
src/index.ts
Commander help configuration is updated with .configureHelp({ showGlobalOptions: true }) to display global options in generated help text.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

  • #37: The error message extensions in auth.ts and connect.ts directly address the request to suggest using --wallet-name <name> as an alternative to overwriting with --force when a connection secret already exists.

Possibly related PRs

  • getAlby/cli#12: Updated the connect command logic that handles "secret already exists" errors; this PR extends those same error messages with additional guidance.
  • getAlby/cli#16: Both PRs modify CLI help behavior in src/index.ts, with this PR enabling global-options display and the related PR updating help text and option ordering.

Suggested reviewers

  • reneaaron

Poem

🐰 A rabbit hops through CLI paths so clear,
Global options now for all to hear!
When wallets connect with names so fine,
Error messages guide users in line.
Help is sweeter, guidance so bright! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main change—improving error messages to suggest --wallet-name when already connected.
Linked Issues check ✅ Passed All changes directly address issue #37 requirements: error messages now suggest --wallet-name as alternative to --force, and global options (including --wallet-name) are displayed in subcommand help.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue #37: error message updates and help configuration are the only modifications present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/already-connected-suggest-wallet-name

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rolznz
Copy link
Copy Markdown
Member Author

rolznz commented May 28, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rolznz rolznz merged commit 3dcc22f into master May 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Already connected error message should suggest creating another wallet as an option

1 participant